<template>
  <h1>child!</h1>
  <h2>age:{{ age }}</h2>
  <h2>length:{{ length }}</h2>
</template>

<script lang="ts">
import {computed, defineComponent, ref, toRef} from 'vue';

const totalLength = (age: ref<any>) => {
  return computed(() => {
    return age.value.toString().length
  })
}
export default defineComponent({
  name: 'App',
  components: {},
  props: {
    age: {
      type: Number,
      require: true
    }
  },
  setup(props) {
    const length = totalLength(toRef(props, 'age'))
    return {
      length
    }
  }
});
</script>

<style>

</style>
